<div class="layui-col-xs6 layui-col-md10 m15">
    <form class="layui-form" action="{:Url::build('submitPassword')}" method="post">
        <div class="layui-form-item">
            <label class="layui-form-label">输入原密码</label>
            <div class="layui-input-block">
                <input type="password" name="old_password" lay-verify="required" placeholder="原密码" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">输入新密码</label>
            <div class="layui-input-block">
                <input type="password" name="password" lay-verify="required|length" placeholder="新密码"
                       class="pass layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">确认密码</label>
            <div class="layui-input-block">
                <input type="password" name="repassword" lay-verify="required|repassword" placeholder="确认密码"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="update_password">立即提交</button>
            </div>
        </div>
    </form>

</div>
<script>
    layui.use(['jquery', 'form', 'layer'], function () {
        layui.form.verify({
            length: function (value) {
                if (value.length < 6) {
                    return "密码必须6个字符以上";
                }
            },
            repassword: function (value) {
                if (value !== layui.$('.pass').val()) {
                    return '两次密码不一致';
                }
            }
        });

        //监听提交
        layui.form.on('submit(update_password)', function (form) {
            layui.$.post(form.form.action, form.field, function (data) {
                status_load(data, form.elem);
            });
            return false;
        });
    });
</script>
